<?php
session_start();
require '../nette/Nette/loader.php';
Debug::enable();
require '../db.php';
require '../localization/lang.php';
require '../core/core.sanitizer.php';
require '../core/core.jobs.php';
require '../core/core.time.php';
require '../core/core.security.php';

$login=new core_security;
$time=new core_time;

if ($login->checklogin()=="OK") {
$job=new core_job;
$job->jid=$_POST['jid'];
$job->uid=$_SESSION['uid'];
$job->jdesc=$_POST['jdesc'];
$job->from=$time->totimestampdef($_SESSION['date2'],$_POST['from']);
$job->to=$time->totimestampdef($_SESSION['date2'],$_POST['to']);
$job->duration=$time->tosec($_POST['duration']);
$job->login=$_SESSION['login'];
$job->note=$_POST['note'];


if ($_POST['action'] == "validate") {
	echo $job->add_validate();
	
	}
	
if ($_POST['action'] == "add") {
	echo $job->add();
	
	}

}
?>